import Vue from 'vue'
import VueRouter from 'vue-router'

import Guide from '@/pages/guide/index.vue'

import Editor from '@/pages/editor/index.vue'
import Detail from '@/pages/detail/index.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/:app/guide',
        component: Guide
    },
    {
        name: 'detail',
        path: '/:app/:namespace/',
        component: Detail
    },
    {
        name: 'editor',
        path: '/:app/:namespace/editor',
        component: Editor
    },
    {
        path: '/guide',
        component: Guide
    },
    {
        path: '/',
        redirect: '/guide'
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
